<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		123
		<script type="text/javascript">
			var Chain = function(fn) {
			  this.fn = fn;
			  this.setNext = function(obj) {
				  this.fn && this.fn()
				  return obj
			  }
			}
			
			var applyDevice = function() {console.log(111)}
			var chainApplyDevice = new Chain(applyDevice);
			
			var selectAddress = function() {console.log(222)}
			var chainSelectAddress = new Chain(selectAddress);
			
			var selectChecker = function() {console.log(333)}
			var chainSelectChecker = new Chain(selectChecker);
			
			// 运用责任链模式实现上边功能
			chainApplyDevice.setNext(chainSelectAddress).setNext(chainSelectChecker).setNext(chainSelectChecker)
			// chainApplyDevice.run();
		</script>
	</body>
</html>
